package com.scrat.huzhenjie.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.scrat.huzhenjie.model.Account;

public class HuangChengShiLoginInterceptor extends HandlerInterceptorAdapter {
	
	@Override  
    public boolean preHandle(HttpServletRequest request,  HttpServletResponse response, Object handler) throws Exception {
		Object obj = request.getSession().getAttribute("recordingUser");
		if(obj==null){
//			request.getRequestDispatcher("WEB-INF/views/login.jsp").forward(request, response); 
//			return false;
			Account account = new Account();
			account.setId(1);
			account.setImei(123);
			account.setPassword("202CB962AC59075B964B07152D234B70");
			account.setTips("202CB962AC59075B964B07152D234B70");
			request.getSession().setAttribute("recordingUser", account);
			return super.preHandle(request, response, handler);
		}
		else{
			return super.preHandle(request, response, handler);
		}
	}
}
